<!DOCTYPE html>

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    <script src="./js/vue.js"></script>
</head>

<body>
    <div id="app">
        <input type="text" v-model="com">
        <button @click="sub">发表评论</button>
        <div v-for="msg in msgs">
            {{msg}}
        </div>
    </div>
    <script>
        var vm = new Vue({
            el: '#app',
            data: {
                com:'',
                msgs:[]
            },
            methods: {
                sub(){
                    this.msgs.push(this.com);
                    this.com = ""

                }
            }
        })
    </script>
</body>

</html>